/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.mto.module.karaoke.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import com.mto.module.karaoke.model.Song;

import java.io.Serializable;

import java.util.Date;

/**
 * The cache model class for representing Song in entity cache.
 *
 * @author vuonglm
 * @see Song
 * @generated
 */
public class SongCacheModel implements CacheModel<Song>, Serializable {
	@Override
	public String toString() {
		StringBundler sb = new StringBundler(21);

		sb.append("{songId=");
		sb.append(songId);
		sb.append(", songName=");
		sb.append(songName);
		sb.append(", songAuthor=");
		sb.append(songAuthor);
		sb.append(", songCategory=");
		sb.append(songCategory);
		sb.append(", songSinger=");
		sb.append(songSinger);
		sb.append(", recordNumber=");
		sb.append(recordNumber);
		sb.append(", songUrl=");
		sb.append(songUrl);
		sb.append(", createDate=");
		sb.append(createDate);
		sb.append(", modifiedDate=");
		sb.append(modifiedDate);
		sb.append(", audioUrl=");
		sb.append(audioUrl);
		sb.append("}");

		return sb.toString();
	}

	public Song toEntityModel() {
		SongImpl songImpl = new SongImpl();

		songImpl.setSongId(songId);

		if (songName == null) {
			songImpl.setSongName(StringPool.BLANK);
		}
		else {
			songImpl.setSongName(songName);
		}

		if (songAuthor == null) {
			songImpl.setSongAuthor(StringPool.BLANK);
		}
		else {
			songImpl.setSongAuthor(songAuthor);
		}

		songImpl.setSongCategory(songCategory);

		if (songSinger == null) {
			songImpl.setSongSinger(StringPool.BLANK);
		}
		else {
			songImpl.setSongSinger(songSinger);
		}

		songImpl.setRecordNumber(recordNumber);

		if (songUrl == null) {
			songImpl.setSongUrl(StringPool.BLANK);
		}
		else {
			songImpl.setSongUrl(songUrl);
		}

		if (createDate == Long.MIN_VALUE) {
			songImpl.setCreateDate(null);
		}
		else {
			songImpl.setCreateDate(new Date(createDate));
		}

		if (modifiedDate == Long.MIN_VALUE) {
			songImpl.setModifiedDate(null);
		}
		else {
			songImpl.setModifiedDate(new Date(modifiedDate));
		}

		if (audioUrl == null) {
			songImpl.setAudioUrl(StringPool.BLANK);
		}
		else {
			songImpl.setAudioUrl(audioUrl);
		}

		songImpl.resetOriginalValues();

		return songImpl;
	}

	public long songId;
	public String songName;
	public String songAuthor;
	public int songCategory;
	public String songSinger;
	public long recordNumber;
	public String songUrl;
	public long createDate;
	public long modifiedDate;
	public String audioUrl;
}